package com.zhouyu.gamecommunity.service.impl;

import com.alibaba.fastjson.JSONObject;
import com.zhouyu.gamecommunity.dao.GameMapper;
import com.zhouyu.gamecommunity.entity.Game;
import com.zhouyu.gamecommunity.entity.Result;
import com.zhouyu.gamecommunity.service.GameService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class GameServiceImpl implements GameService {
    @Resource
    private GameMapper gameMapper;

    @Override
    public Result<List<Game>> getRecommendGameList() {
        //生成0-200 的随机整数
        int randomNum = (int) (Math.random() * 200);
        return Result.success(gameMapper.pageList(randomNum, 15));
    }

    @Override
    public Result<List<Game>> getTopGameListByType(Integer type) {
        return Result.success(gameMapper.getTopGameListByType(type));
    }
}
